import mongoose from 'mongoose'
// 生成Schema模型
const Schema = mongoose.Schema
const UserSchema = new Schema({
  username: {
    // 类型
    type: String,
    // 必须的
    require: true
  },
  studentNum: {
    type: String,
    // 唯一的
    unique: true,
    require: true
  },
  password: {
    type: String,
    require: true
  },
  email: {
    type: String,
    require: true
  },
  role: {
    type: String,
    require: true,
    default: 'student'
  },
  token: {
    type: String
  }
})

export default mongoose.model('User', UserSchema)
